--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit d00fdd2ff41224f704119975805f92a0a985a31b
Parents : cae7f29
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-26T04:03:32+02:00
Added ability to use direct HDX PTT
Changes
3 files changed, 48 insertions(+), 3 deletions(-)
Diff
diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index f84de141..4f09f9b6 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -847,6 +847,7 @@ class SidebandCore():
if not "voice_loudspeaker" in self.config: self.config["voice_loudspeaker"] = None
if not "voice_trusted_only" in self.config: self.config["voice_trusted_only"] = False
if not "voice_hdx_loudspeaker" in self.config: self.config["voice_hdx_loudspeaker"] = True
+ if not "voice_hdx_direct_ptt" in self.config: self.config["voice_hdx_direct_ptt"] = False
if not "voice_low_latency" in self.config: self.config["voice_low_latency"] = False
# Make sure we have a database
diff --git a/sbapp/sideband/voice.py b/sbapp/sideband/voice.py
index 377fae04..40b454e7 100644
--- a/sbapp/sideband/voice.py
+++ b/sbapp/sideband/voice.py
@@ -4,9 +4,10 @@ import RNS
import os
import sys
import time
+import threading
from LXST._version import __version__
-from LXST.Primitives.Telephony import Telephone
+from LXST.Primitives.Telephony import Telephone, Profiles
from RNS.vendor.configobj import ConfigObj
import RNS.vendor.umsgpack as msgpack
@@ -249,13 +250,35 @@ class ReticulumTelephone():
def switch_mode(self, mode):
self.telephone.switch_mode(mode)
+ def direct_ptt_allowed(self, remote_identity):
+ if self.owner.config["voice_hdx_direct_ptt"] != True: return False
+ context_dest = RNS.Destination.hash(remote_identity, "lxmf", "delivery")
+ is_trusted = self.owner.is_trusted(context_dest)
+ ptt_enabled = self.owner.ptt_enabled(context_dest)
+ if is_trusted and ptt_enabled: return True
+ else: return False
+
+ def check_auto_answer(self, remote_identity):
+ if self.owner.config["voice_hdx_direct_ptt"] != True: return False
+ def job():
+ timeout = time.time() + 1.0
+ while time.time() < timeout and self.is_ringing and not self.is_in_call:
+ time.sleep(0.2)
+ if self.active_mode == Profiles.MODE_HALF_DUPLEX:
+ if self.direct_ptt_allowed(remote_identity):
+ if self.owner.config["voice_hdx_loudspeaker"]: self.enable_loudspeaker(True)
+ self.answer()
+
+ threading.Thread(target=job, daemon=True).start()
+
def ringing(self, remote_identity):
if self.hw_state == self.HW_STATE_SLEEP: self.hw_state = self.HW_STATE_IDLE
self.state = self.STATE_RINGING
self.caller = remote_identity
self.direction = "from" if self.direction == None else "to"
- RNS.log(f"Incoming call from {RNS.prettyhexrep(self.caller.hash)}", RNS.LOG_DEBUG)
+ RNS.log(f"Incoming {Profiles.mode_abbrevation(self.active_mode)} call from {RNS.prettyhexrep(self.caller.hash)}", RNS.LOG_DEBUG)
if self.owner:
+ if self.direct_ptt_allowed(remote_identity): self.check_auto_answer(remote_identity)
self.owner.incoming_call(remote_identity)
def call_ended(self, remote_identity):
diff --git a/sbapp/ui/voice.py b/sbapp/ui/voice.py
index 4eb14f8c..c8eed1bd 100644
--- a/sbapp/ui/voice.py
+++ b/sbapp/ui/voice.py
@@ -154,6 +154,7 @@ class Voice():
rm.disabled = False
tm.disabled = False
tb.disabled = False
+ if telephone.caller: ih.text = RNS.hexrep(telephone.caller.hash, delimit=False)
else:
rm.disabled = True
tm.disabled = True
@@ -196,16 +197,18 @@ class Voice():
tm.icon = "microphone"
if telephone.is_in_call or telephone.call_is_connecting or telephone.is_ringing:
+ if not self.dial_target: self.dial_target = self.telephone.caller.hash
stats = telephone.call_stats
t_str = RNS.prettytime(int(stats["time"])) if stats["time"] else None
rxb = stats["rxb"]
txb = stats["txb"]
+ r_str = ""
if telephone.is_ringing:
disp_name = peer_disp_name = multilingual_markup(escape_markup(str(self.app.sideband.voice_display_name(telephone.caller.hash))).encode("utf-8")).decode("utf-8")
r_str = f"Call from {disp_name}"
- else:
+ elif self.dial_target:
disp_name = peer_disp_name = multilingual_markup(escape_markup(str(self.app.sideband.voice_display_name(self.dial_target))).encode("utf-8")).decode("utf-8")
r_str = f"Call with {disp_name}"
@@ -471,6 +474,8 @@ class Voice():
self.voice_settings_screen.ids.voice_trusted_only.bind(active=self.settings_save_action)
self.voice_settings_screen.ids.voice_hdx_loudspeaker.active = self.app.sideband.config["voice_hdx_loudspeaker"]
self.voice_settings_screen.ids.voice_hdx_loudspeaker.bind(active=self.settings_save_action)
+ self.voice_settings_screen.ids.voice_hdx_direct_ptt.active = self.app.sideband.config["voice_hdx_direct_ptt"]
+ self.voice_settings_screen.ids.voice_hdx_direct_ptt.bind(active=self.settings_save_action)
self.voice_settings_screen.ids.voice_low_latency.active = self.app.sideband.config["voice_low_latency"]
self.voice_settings_screen.ids.voice_low_latency.bind(active=self.settings_save_action)
@@ -558,6 +563,7 @@ class Voice():
def settings_save_action(self, sender=None, event=None):
self.app.sideband.config["voice_trusted_only"] = self.voice_settings_screen.ids.voice_trusted_only.active
self.app.sideband.config["voice_hdx_loudspeaker"] = self.voice_settings_screen.ids.voice_hdx_loudspeaker.active
+ self.app.sideband.config["voice_hdx_direct_ptt"] = self.voice_settings_screen.ids.voice_hdx_direct_ptt.active
self.app.sideband.config["voice_low_latency"] = self.voice_settings_screen.ids.voice_low_latency.active
self.app.sideband.save_configuration()
if self.app.sideband.telephone:
@@ -1004,6 +1010,21 @@ MDScreen:
pos_hint: {"center_y": 0.3}
active: False
+ MDBoxLayout:
+ orientation: "horizontal"
+ padding: [0,0,dp(24),0]
+ size_hint_y: None
+ height: dp(48)
+
+ MDLabel:
+ text: "Direct HDX PTT from trusted"
+ font_style: "H6"
+
+ MDSwitch:
+ id: voice_hdx_direct_ptt
+ pos_hint: {"center_y": 0.3}
+ active: False
+
MDBoxLayout:
orientation: "horizontal"
padding: [0,0,dp(24),0]
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────